<?php
include_once "viewMySchedule.php";
?>
<h2>Upcoming Shifts</h2>
<!--  start PHP -->
<?php
//process releasing shift
//include releaseShift.php
if(isset($_GET['RoleID']) && isset($_GET['DateID'])){
	//releaseShift(userName, userPassHash,  shiftNotDesired);
}

//output upcoming shifts
$result = json_decode(viewMySchedule("Cesar", "CesarHASH"));
$shifts = null;

foreach ($result as &$resultEntry) {
	$shifts=$resultEntry->shifts;
}

echo '<table>';
foreach ($shifts as &$shiftsEntry) {
	echo '<tr><td>';
	echo '<form action="upcoming.php">';
	echo '<table>';
	$shiftDate = $shiftsEntry->Date;
	echo '<tr><td>' . date("Y-m-d", $shiftDate) . '</td>';
	echo '<td>' . $shiftsEntry->StartTime . '</td>';
	echo '<td><input type="submit" value="Offer Shift" /></td></tr>';
	echo '<tr><td>' . $shiftsEntry->RoleID . '</td>';
	echo '<td>' . $shiftsEntry->EndTime . '</td>';
	echo '<td>' . $shiftsEntry->ShiftStatus . '</td></tr>';
	echo '</table>';
	echo '</form>';
	echo '</td></tr>';
}
echo '</table>';
?>
<!--  end PHP -->
